// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by google-apis-code-generator 1.5.1
//     C# generator version: 1.22.0
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

/**
 * \brief
 *   Google Cloud Billing API Version v1
 *
 * \section ApiInfo API Version Information
 *    <table>
 *      <tr><th>API
 *          <td><a href='https://cloud.google.com/billing/'>Google Cloud Billing API</a>
 *      <tr><th>API Version<td>v1
 *      <tr><th>API Rev<td>20170210 (771)
 *      <tr><th>API Docs
 *          <td><a href='https://cloud.google.com/billing/'>
 *              https://cloud.google.com/billing/</a>
 *      <tr><th>Discovery Name<td>cloudbilling
 *    </table>
 *
 * \section ForMoreInfo For More Information
 *
 * The complete API documentation for using Google Cloud Billing API can be found at
 * <a href='https://cloud.google.com/billing/'>https://cloud.google.com/billing/</a>.
 *
 * For more information about the Google APIs Client Library for .NET, see
 * <a href='https://developers.google.com/api-client-library/dotnet/get_started'>
 * https://developers.google.com/api-client-library/dotnet/get_started</a>
 */

namespace Google.Apis.Cloudbilling.v1
{
    /// <summary>The Cloudbilling Service.</summary>
    public class CloudbillingService : Google.Apis.Services.BaseClientService
    {
        /// <summary>The API version.</summary>
        public const string Version = "v1";

        /// <summary>The discovery version used to generate this service.</summary>
        public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed =
            Google.Apis.Discovery.DiscoveryVersion.Version_1_0;

        /// <summary>Constructs a new service.</summary>
        public CloudbillingService() :
            this(new Google.Apis.Services.BaseClientService.Initializer()) {}

        /// <summary>Constructs a new service.</summary>
        /// <param name="initializer">The service initializer.</param>
        public CloudbillingService(Google.Apis.Services.BaseClientService.Initializer initializer)
            : base(initializer)
        {
            billingAccounts = new BillingAccountsResource(this);
            projects = new ProjectsResource(this);
        }

        /// <summary>Gets the service supported features.</summary>
        public override System.Collections.Generic.IList<string> Features
        {
            get { return new string[0]; }
        }

        /// <summary>Gets the service name.</summary>
        public override string Name
        {
            get { return "cloudbilling"; }
        }

        /// <summary>Gets the service base URI.</summary>
        public override string BaseUri
        {
            get { return "https://cloudbilling.googleapis.com/"; }
        }

        /// <summary>Gets the service base path.</summary>
        public override string BasePath
        {
            get { return ""; }
        }

        /// <summary>Available OAuth 2.0 scopes for use with the Google Cloud Billing API.</summary>
        public class Scope
        {
            /// <summary>View and manage your data across Google Cloud Platform services</summary>
            public static string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";

        }



        private readonly BillingAccountsResource billingAccounts;

        /// <summary>Gets the BillingAccounts resource.</summary>
        public virtual BillingAccountsResource BillingAccounts
        {
            get { return billingAccounts; }
        }

        private readonly ProjectsResource projects;

        /// <summary>Gets the Projects resource.</summary>
        public virtual ProjectsResource Projects
        {
            get { return projects; }
        }
    }

    ///<summary>A base abstract class for Cloudbilling requests.</summary>
    public abstract class CloudbillingBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse>
    {
        ///<summary>Constructs a new CloudbillingBaseServiceRequest instance.</summary>
        protected CloudbillingBaseServiceRequest(Google.Apis.Services.IClientService service)
            : base(service)
        {
        }

        /// <summary>V1 error format.</summary>
        [Google.Apis.Util.RequestParameterAttribute("$.xgafv", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<XgafvEnum> Xgafv { get; set; }

        /// <summary>V1 error format.</summary>
        public enum XgafvEnum
        {
            /// <summary>v1 error format</summary>
            [Google.Apis.Util.StringValueAttribute("1")]
            Value1,
            /// <summary>v2 error format</summary>
            [Google.Apis.Util.StringValueAttribute("2")]
            Value2,
        }

        /// <summary>OAuth access token.</summary>
        [Google.Apis.Util.RequestParameterAttribute("access_token", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string AccessToken { get; set; }

        /// <summary>Data format for response.</summary>
        /// [default: json]
        [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<AltEnum> Alt { get; set; }

        /// <summary>Data format for response.</summary>
        public enum AltEnum
        {
            /// <summary>Responses with Content-Type of application/json</summary>
            [Google.Apis.Util.StringValueAttribute("json")]
            Json,
            /// <summary>Media download with context-dependent Content-Type</summary>
            [Google.Apis.Util.StringValueAttribute("media")]
            Media,
            /// <summary>Responses with Content-Type of application/x-protobuf</summary>
            [Google.Apis.Util.StringValueAttribute("proto")]
            Proto,
        }

        /// <summary>OAuth bearer token.</summary>
        [Google.Apis.Util.RequestParameterAttribute("bearer_token", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string BearerToken { get; set; }

        /// <summary>JSONP</summary>
        [Google.Apis.Util.RequestParameterAttribute("callback", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string Callback { get; set; }

        /// <summary>Selector specifying which fields to include in a partial response.</summary>
        [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string Fields { get; set; }

        /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and reports.
        /// Required unless you provide an OAuth 2.0 token.</summary>
        [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string Key { get; set; }

        /// <summary>OAuth 2.0 token for the current user.</summary>
        [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string OauthToken { get; set; }

        /// <summary>Pretty-print response.</summary>
        /// [default: true]
        [Google.Apis.Util.RequestParameterAttribute("pp", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<bool> Pp { get; set; }

        /// <summary>Returns response with indentations and line breaks.</summary>
        /// [default: true]
        [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<bool> PrettyPrint { get; set; }

        /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary string
        /// assigned to a user, but should not exceed 40 characters.</summary>
        [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string QuotaUser { get; set; }

        /// <summary>Legacy upload protocol for media (e.g. "media", "multipart").</summary>
        [Google.Apis.Util.RequestParameterAttribute("uploadType", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string UploadType { get; set; }

        /// <summary>Upload protocol for media (e.g. "raw", "multipart").</summary>
        [Google.Apis.Util.RequestParameterAttribute("upload_protocol", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string UploadProtocol { get; set; }

        /// <summary>Initializes Cloudbilling parameter list.</summary>
        protected override void InitParameters()
        {
            base.InitParameters();

            RequestParameters.Add(
                "$.xgafv", new Google.Apis.Discovery.Parameter
                {
                    Name = "$.xgafv",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "access_token", new Google.Apis.Discovery.Parameter
                {
                    Name = "access_token",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "alt", new Google.Apis.Discovery.Parameter
                {
                    Name = "alt",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = "json",
                    Pattern = null,
                });
            RequestParameters.Add(
                "bearer_token", new Google.Apis.Discovery.Parameter
                {
                    Name = "bearer_token",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "callback", new Google.Apis.Discovery.Parameter
                {
                    Name = "callback",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "fields", new Google.Apis.Discovery.Parameter
                {
                    Name = "fields",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "key", new Google.Apis.Discovery.Parameter
                {
                    Name = "key",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "oauth_token", new Google.Apis.Discovery.Parameter
                {
                    Name = "oauth_token",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "pp", new Google.Apis.Discovery.Parameter
                {
                    Name = "pp",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = "true",
                    Pattern = null,
                });
            RequestParameters.Add(
                "prettyPrint", new Google.Apis.Discovery.Parameter
                {
                    Name = "prettyPrint",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = "true",
                    Pattern = null,
                });
            RequestParameters.Add(
                "quotaUser", new Google.Apis.Discovery.Parameter
                {
                    Name = "quotaUser",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "uploadType", new Google.Apis.Discovery.Parameter
                {
                    Name = "uploadType",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "upload_protocol", new Google.Apis.Discovery.Parameter
                {
                    Name = "upload_protocol",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
        }
    }

    /// <summary>The "billingAccounts" collection of methods.</summary>
    public class BillingAccountsResource
    {
        private const string Resource = "billingAccounts";

        /// <summary>The service which this resource belongs to.</summary>
        private readonly Google.Apis.Services.IClientService service;

        /// <summary>Constructs a new resource.</summary>
        public BillingAccountsResource(Google.Apis.Services.IClientService service)
        {
            this.service = service;
            projects = new ProjectsResource(service);

        }

        private readonly ProjectsResource projects;

        /// <summary>Gets the Projects resource.</summary>
        public virtual ProjectsResource Projects
        {
            get { return projects; }
        }

        /// <summary>The "projects" collection of methods.</summary>
        public class ProjectsResource
        {
            private const string Resource = "projects";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public ProjectsResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;

            }


            /// <summary>Lists the projects associated with a billing account. The current authenticated user must be an
            /// [owner of the billing account](https://support.google.com/cloud/answer/4430947).</summary>
            /// <param name="name">The resource name of the billing account associated with the projects that you want to list. For
            /// example, `billingAccounts/012345-567890-ABCDEF`.</param>
            public virtual ListRequest List(string name)
            {
                return new ListRequest(service, name);
            }

            /// <summary>Lists the projects associated with a billing account. The current authenticated user must be an
            /// [owner of the billing account](https://support.google.com/cloud/answer/4430947).</summary>
            public class ListRequest : CloudbillingBaseServiceRequest<Google.Apis.Cloudbilling.v1.Data.ListProjectBillingInfoResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string name)
                    : base(service)
                {
                    Name = name;
                    InitParameters();
                }


                /// <summary>The resource name of the billing account associated with the projects that you want to
                /// list. For example, `billingAccounts/012345-567890-ABCDEF`.</summary>
                [Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Name { get; private set; }

                /// <summary>Requested page size. The maximum page size is 100; this is also the default.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<int> PageSize { get; set; }

                /// <summary>A token identifying a page of results to be returned. This should be a `next_page_token`
                /// value returned from a previous `ListProjectBillingInfo` call. If unspecified, the first page of
                /// results is returned.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string PageToken { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "v1/{+name}/projects"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "name", new Google.Apis.Discovery.Parameter
                        {
                            Name = "name",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = @"^billingAccounts/[^/]+$",
                        });
                    RequestParameters.Add(
                        "pageSize", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageSize",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "pageToken", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageToken",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }
        }

        /// <summary>Gets information about a billing account. The current authenticated user must be an [owner of the
        /// billing account](https://support.google.com/cloud/answer/4430947).</summary>
        /// <param name="name">The resource name of the billing account to retrieve. For example,
        /// `billingAccounts/012345-567890-ABCDEF`.</param>
        public virtual GetRequest Get(string name)
        {
            return new GetRequest(service, name);
        }

        /// <summary>Gets information about a billing account. The current authenticated user must be an [owner of the
        /// billing account](https://support.google.com/cloud/answer/4430947).</summary>
        public class GetRequest : CloudbillingBaseServiceRequest<Google.Apis.Cloudbilling.v1.Data.BillingAccount>
        {
            /// <summary>Constructs a new Get request.</summary>
            public GetRequest(Google.Apis.Services.IClientService service, string name)
                : base(service)
            {
                Name = name;
                InitParameters();
            }


            /// <summary>The resource name of the billing account to retrieve. For example,
            /// `billingAccounts/012345-567890-ABCDEF`.</summary>
            [Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string Name { get; private set; }


            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "get"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "GET"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "v1/{+name}"; }
            }

            /// <summary>Initializes Get parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "name", new Google.Apis.Discovery.Parameter
                    {
                        Name = "name",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = null,
                        Pattern = @"^billingAccounts/[^/]+$",
                    });
            }

        }

        /// <summary>Lists the billing accounts that the current authenticated user
        /// [owns](https://support.google.com/cloud/answer/4430947).</summary>
        public virtual ListRequest List()
        {
            return new ListRequest(service);
        }

        /// <summary>Lists the billing accounts that the current authenticated user
        /// [owns](https://support.google.com/cloud/answer/4430947).</summary>
        public class ListRequest : CloudbillingBaseServiceRequest<Google.Apis.Cloudbilling.v1.Data.ListBillingAccountsResponse>
        {
            /// <summary>Constructs a new List request.</summary>
            public ListRequest(Google.Apis.Services.IClientService service)
                : base(service)
            {
                InitParameters();
            }


            /// <summary>Requested page size. The maximum page size is 100; this is also the default.</summary>
            [Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
            public virtual System.Nullable<int> PageSize { get; set; }

            /// <summary>A token identifying a page of results to return. This should be a `next_page_token` value
            /// returned from a previous `ListBillingAccounts` call. If unspecified, the first page of results is
            /// returned.</summary>
            [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
            public virtual string PageToken { get; set; }


            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "list"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "GET"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "v1/billingAccounts"; }
            }

            /// <summary>Initializes List parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "pageSize", new Google.Apis.Discovery.Parameter
                    {
                        Name = "pageSize",
                        IsRequired = false,
                        ParameterType = "query",
                        DefaultValue = null,
                        Pattern = null,
                    });
                RequestParameters.Add(
                    "pageToken", new Google.Apis.Discovery.Parameter
                    {
                        Name = "pageToken",
                        IsRequired = false,
                        ParameterType = "query",
                        DefaultValue = null,
                        Pattern = null,
                    });
            }

        }
    }

    /// <summary>The "projects" collection of methods.</summary>
    public class ProjectsResource
    {
        private const string Resource = "projects";

        /// <summary>The service which this resource belongs to.</summary>
        private readonly Google.Apis.Services.IClientService service;

        /// <summary>Constructs a new resource.</summary>
        public ProjectsResource(Google.Apis.Services.IClientService service)
        {
            this.service = service;

        }


        /// <summary>Gets the billing information for a project. The current authenticated user must have [permission to
        /// view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ).</summary>
        /// <param name="name">The resource name of the project for which billing information is retrieved. For example,
        /// `projects/tokyo-rain-123`.</param>
        public virtual GetBillingInfoRequest GetBillingInfo(string name)
        {
            return new GetBillingInfoRequest(service, name);
        }

        /// <summary>Gets the billing information for a project. The current authenticated user must have [permission to
        /// view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ).</summary>
        public class GetBillingInfoRequest : CloudbillingBaseServiceRequest<Google.Apis.Cloudbilling.v1.Data.ProjectBillingInfo>
        {
            /// <summary>Constructs a new GetBillingInfo request.</summary>
            public GetBillingInfoRequest(Google.Apis.Services.IClientService service, string name)
                : base(service)
            {
                Name = name;
                InitParameters();
            }


            /// <summary>The resource name of the project for which billing information is retrieved. For example,
            /// `projects/tokyo-rain-123`.</summary>
            [Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string Name { get; private set; }


            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "getBillingInfo"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "GET"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "v1/{+name}/billingInfo"; }
            }

            /// <summary>Initializes GetBillingInfo parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "name", new Google.Apis.Discovery.Parameter
                    {
                        Name = "name",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = null,
                        Pattern = @"^projects/[^/]+$",
                    });
            }

        }

        /// <summary>Sets or updates the billing account associated with a project. You specify the new billing account
        /// by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing
        /// account. Associating a project with an open billing account enables billing on the project and allows
        /// charges for resource usage. If the project already had a billing account, this method changes the billing
        /// account used for resource usage charges.
        ///
        /// *Note:* Incurred charges that have not yet been reported in the transaction history of the Google Cloud
        /// Console may be billed to the new billing account, even if the charge occurred before the new billing account
        /// was assigned to the project.
        ///
        /// The current authenticated user must have ownership privileges for both the
        /// [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing
        /// account](https://support.google.com/cloud/answer/4430947).
        ///
        /// You can disable billing on the project by setting the `billing_account_name` field to empty. This action
        /// disassociates the current billing account from the project. Any billable activity of your in-use services
        /// will stop, and your application could stop functioning as expected. Any unbilled charges to date will be
        /// billed to the previously associated account. The current authenticated user must be either an owner of the
        /// project or an owner of the billing account for the project.
        ///
        /// Note that associating a project with a *closed* billing account will have much the same effect as disabling
        /// billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to
        /// disable billing, you should always call this method with the name of an *open* billing account.</summary>
        /// <param name="body">The body of the request.</param>
        /// <param name="name">The resource name of the project associated with the billing information that you want to update.
        /// For example, `projects/tokyo-rain-123`.</param>
        public virtual UpdateBillingInfoRequest UpdateBillingInfo(Google.Apis.Cloudbilling.v1.Data.ProjectBillingInfo body, string name)
        {
            return new UpdateBillingInfoRequest(service, body, name);
        }

        /// <summary>Sets or updates the billing account associated with a project. You specify the new billing account
        /// by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing
        /// account. Associating a project with an open billing account enables billing on the project and allows
        /// charges for resource usage. If the project already had a billing account, this method changes the billing
        /// account used for resource usage charges.
        ///
        /// *Note:* Incurred charges that have not yet been reported in the transaction history of the Google Cloud
        /// Console may be billed to the new billing account, even if the charge occurred before the new billing account
        /// was assigned to the project.
        ///
        /// The current authenticated user must have ownership privileges for both the
        /// [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing
        /// account](https://support.google.com/cloud/answer/4430947).
        ///
        /// You can disable billing on the project by setting the `billing_account_name` field to empty. This action
        /// disassociates the current billing account from the project. Any billable activity of your in-use services
        /// will stop, and your application could stop functioning as expected. Any unbilled charges to date will be
        /// billed to the previously associated account. The current authenticated user must be either an owner of the
        /// project or an owner of the billing account for the project.
        ///
        /// Note that associating a project with a *closed* billing account will have much the same effect as disabling
        /// billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to
        /// disable billing, you should always call this method with the name of an *open* billing account.</summary>
        public class UpdateBillingInfoRequest : CloudbillingBaseServiceRequest<Google.Apis.Cloudbilling.v1.Data.ProjectBillingInfo>
        {
            /// <summary>Constructs a new UpdateBillingInfo request.</summary>
            public UpdateBillingInfoRequest(Google.Apis.Services.IClientService service, Google.Apis.Cloudbilling.v1.Data.ProjectBillingInfo body, string name)
                : base(service)
            {
                Name = name;
                Body = body;
                InitParameters();
            }


            /// <summary>The resource name of the project associated with the billing information that you want to
            /// update. For example, `projects/tokyo-rain-123`.</summary>
            [Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string Name { get; private set; }


            /// <summary>Gets or sets the body of this request.</summary>
            Google.Apis.Cloudbilling.v1.Data.ProjectBillingInfo Body { get; set; }

            ///<summary>Returns the body of the request.</summary>
            protected override object GetBody() { return Body; }

            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "updateBillingInfo"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "PUT"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "v1/{+name}/billingInfo"; }
            }

            /// <summary>Initializes UpdateBillingInfo parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "name", new Google.Apis.Discovery.Parameter
                    {
                        Name = "name",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = null,
                        Pattern = @"^projects/[^/]+$",
                    });
            }

        }
    }
}

namespace Google.Apis.Cloudbilling.v1.Data
{    

    /// <summary>A billing account in [Google Cloud Console](https://console.cloud.google.com/). You can assign a
    /// billing account to one or more projects.</summary>
    public class BillingAccount : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The display name given to the billing account, such as `My Billing Account`. This name is displayed
        /// in the Google Cloud Console.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("displayName")]
        public virtual string DisplayName { get; set; } 

        /// <summary>The resource name of the billing account. The resource name has the form
        /// `billingAccounts/{billing_account_id}`. For example, `billingAccounts/012345-567890-ABCDEF` would be the
        /// resource name for billing account `012345-567890-ABCDEF`.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("name")]
        public virtual string Name { get; set; } 

        /// <summary>True if the billing account is open, and will therefore be charged for any usage on associated
        /// projects. False if the billing account is closed, and therefore projects associated with it will be unable
        /// to use paid services.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("open")]
        public virtual System.Nullable<bool> Open { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Response message for `ListBillingAccounts`.</summary>
    public class ListBillingAccountsResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A list of billing accounts.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("billingAccounts")]
        public virtual System.Collections.Generic.IList<BillingAccount> BillingAccounts { get; set; } 

        /// <summary>A token to retrieve the next page of results. To retrieve the next page, call `ListBillingAccounts`
        /// again with the `page_token` field set to this value. This field is empty if there are no more results to
        /// retrieve.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Request message for `ListProjectBillingInfoResponse`.</summary>
    public class ListProjectBillingInfoResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A token to retrieve the next page of results. To retrieve the next page, call
        /// `ListProjectBillingInfo` again with the `page_token` field set to this value. This field is empty if there
        /// are no more results to retrieve.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>A list of `ProjectBillingInfo` resources representing the projects associated with the billing
        /// account.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("projectBillingInfo")]
        public virtual System.Collections.Generic.IList<ProjectBillingInfo> ProjectBillingInfo { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Encapsulation of billing information for a Cloud Console project. A project has at most one associated
    /// billing account at a time (but a billing account can be assigned to multiple projects).</summary>
    public class ProjectBillingInfo : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The resource name of the billing account associated with the project, if any. For example,
        /// `billingAccounts/012345-567890-ABCDEF`.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("billingAccountName")]
        public virtual string BillingAccountName { get; set; } 

        /// <summary>True if the project is associated with an open billing account, to which usage on the project is
        /// charged. False if the project is associated with a closed billing account, or no billing account at all, and
        /// therefore cannot use paid services. This field is read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("billingEnabled")]
        public virtual System.Nullable<bool> BillingEnabled { get; set; } 

        /// <summary>The resource name for the `ProjectBillingInfo`; has the form `projects/{project_id}/billingInfo`.
        /// For example, the resource name for the billing information for project `tokyo-rain-123` would be `projects
        /// /tokyo-rain-123/billingInfo`. This field is read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("name")]
        public virtual string Name { get; set; } 

        /// <summary>The ID of the project that this `ProjectBillingInfo` represents, such as `tokyo-rain-123`. This is
        /// a convenience field so that you don't need to parse the `name` field to obtain a project ID. This field is
        /// read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("projectId")]
        public virtual string ProjectId { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }
}
